Integrate and Fire model; IF model
$ \tau\frac{dV(t)}{dt} = -V(t) + E_L + R I(t)
詳細なチャネルの動態を簡略化した代わりに、簡単に神経細胞集団の活動をモデル化できる。
HH方程式(Hodgkin-Huxley Equations)からの式変形で導出できる
if $ V(t) \ge V_\theta,$ V(t) = V_r
code:IFmodel.py
tau = 20 #時定数
R = 1 #抵抗
El = -50 # resting potential(静止電位)
Vth = -40 # threshold(この値を超えたら発火(fire))
Vs = 40 # spike height(発火した際の電位)
Vr = -80 # reset(発火したらこの電位にリセット)
def integ(t, v, stim=0.): # integrate
if callable(stim): #刺激が関数かどうかのチェック
I = stim(t) # time-dependent
else:
I = stim # constant
return (-v + El + R*I)/tau
def fire(t, v): # fire
return (-1 if v>=Vth else 0) # stop if v>=V1
code: IFode.py
iaf = ode(integ)#微分方程式をシミュレーション
iaf.set_integrator('dopri5') # Dormand-Prince法で数値計算
iaf.set_solout(fire) # 電位が閾値を超えていないかをチェック
iaf.set_initial_value(Vr, 0) # 電位と時間の初期値を設定
iaf.set_f_params(ramp) # 電流刺激をramp関数で行う
V = Vr # 電位の時間変化を保存
T = 0 # 電位を記録した時間を保存
t_end = 300 # 終了タイミング
dt = 10 # 時間幅
while iaf.successful() and iaf.t <= t_end:
v = iaf.integrate(iaf.t+dt) # step
V.append(v0) # record V
T.append(iaf.t) # record t
if v >= Vth: # threshold reached
iaf.set_initial_value(Vr, iaf.t) # reset V
V.append(Vs) # spike
T.append(iaf.t)
V.append(Vr) # reset
T.append(iaf.t)
plt.plot(T, ramp(T))
plt.plot(T, V);
plt.xlabel("t")
plt.ylabel("I, V");
plt.legend(("I(t)", "V(t)"));
Dormand-Prince法